package com.example.t410.controller;


import com.alibaba.fastjson.JSONObject;
import com.example.t410.DTO.IntroductionPCCDTO;
import com.example.t410.service.IntroductionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@CrossOrigin
@RequestMapping("/introduction")
public class IntroductionController {

    JSONObject jsonObject = new JSONObject();

    @Autowired
    private IntroductionService introductionService;
    @GetMapping("/pcc")
    public JSONObject getPCC(IntroductionPCCDTO introductionPCCDTO)
    {
        log.info("心理咨询中心查询{}",introductionPCCDTO);
        jsonObject.clear();
        jsonObject.put("status","200");
        jsonObject.put("data",introductionService.findPCCs(introductionPCCDTO));
        return jsonObject;
    }
    @GetMapping("/pcc/{id}")
    public JSONObject getPCC(@PathVariable Long id)
    {
        log.info("心理咨询中心具体细节查询，id为：{}",id);
        jsonObject.clear();
        jsonObject.put("status","200");
        jsonObject.put("data",introductionService.findDatial(id));
        return jsonObject;
    }
}
